const { log } = require('console');
const fs = require('fs');
const path = require('path');
const fileName = path.relative(__dirname,"./1.txt")

// 写入文件
async function test(){
    const content = "hello world";
    // await fs.promises.writeFile(fileName,content,{
    //     flag:"a"// flag:"a" 追加写入  flag:"w" 覆盖写入
    // }); 

    const buffer = Buffer.from('qweqwe');
    await fs.promises.writeFile(fileName,buffer);
    console.log("写入文件成功");
}
test()